//
//  OthersListenCell.swift
//  TianTianBiTing
//
//  Created by Gox mac 2 on 2018/12/21.
//  Copyright © 2018 Gox_WallyDiao. All rights reserved.
//

import UIKit

class OthersListenCell: UICollectionViewCell {
    var imageView = UIImageView.init()
    var label = UILabel.init()
    
    var imageView1 = UIImageView.init()
    
    var imageView2 = UIImageView.init()
    var label2 = UILabel.init()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUI()
    }
    
    func setUI() {
        
        self.contentView.addSubview(self.imageView)
        self.contentView.addSubview(self.label)
        self.imageView.addSubview(self.imageView1)
        self.imageView.addSubview(self.imageView2)
        self.imageView.addSubview(self.label2)
        
        self.imageView.layer.cornerRadius = 3
        self.imageView.layer.masksToBounds = true
        self.label.font = Font_Medium(12)
        self.label.textAlignment = .left
        self.label.numberOfLines = 2
        
        self.imageView1.image = IMAGE(name: "blackBg")
        self.imageView2.image = IMAGE(name: "home_listen_white")
        
        self.label2.font = Font_Medium(12)
        self.label2.textAlignment = .left
        self.label2.textColor = WhiteBackColor
        
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
        
        
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        let contentWidth = self.contentView.bounds.size.width
        
        self.imageView.frame = FRAME_CGFloat(0, 0, contentWidth, contentWidth)
        
//        let frameNew = self.label.text?.stringHeightWith(fontSize: 12, width: contentWidth)
//        self.label.frame = FRAME_CGFloat(0, contentWidth, contentWidth, frameNew ?? 35)
        
        self.imageView1.frame = FRAME_CGFloat(0, 0, contentWidth, 44)
        self.imageView2.frame = FRAME_CGFloat(5, 5, 12.5, 12.5)
        self.label2.frame = FRAME_CGFloat(20, 3, contentWidth - 20, 16.5)
    }
    
}
